package com.college.common.utils.security;

import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import sun.misc.BASE64Decoder;

import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;


/**
 * @author 小C工作室
 * @date 2022/9/27 17:55
 * @project manager_system_server
 * @company 韦伯创想
 * @description 机构筛选加密工具
 */
@Slf4j
public class DistributorScreenSecretUtils {

	private static final String RSA = "RSA";

	/**
	 * 公钥
	 */
	public static String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkQbuxVp1DtUuPqpv0RB+L3gSsfsPdxp1JPF7cnDCphbYpAsGeEfRN8km0fX4PslkgT39C3aPEFuCxaFtygcgr8PP8GmlirQCtXVTLDsgCo0706Ip8gBkipUVu7PId7nuAJjLgNQ4bDB91mTtpFeTN5bZ3VLQXNUp1X0btfuA9xMp1aT5vlJiS5JQL1Qq7PMUdGLQ1KRV2fQXkTtcOGHAMUi5HD5r8o4nCLlW9QEUPAdSRTucAbnxj87DmSyqRu0qc+K1292qiJUvF9Qv1uLN0PqFv1h2+S76isF8HIcwSy05Dp5e2/4Czs9VD1F6JZkrIVwsFoEo0SxRCEl1PGEQrQIDAQAB";
	/**
	 * 私钥
	 */
	public static String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCRBu7FWnUO1S4+qm/REH4veBKx+w93GnUk8XtycMKmFtikCwZ4R9E3ySbR9fg+yWSBPf0Ldo8QW4LFoW3KByCvw8/waaWKtAK1dVMsOyAKjTvToinyAGSKlRW7s8h3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z2Pix8ZyVZbq3ICiCpy9OrLbSWkQKBgQCaOPRsWODuAKYez1nwLU8vMjic6gv9ETMS5OmR7awWZBZobN977MVRoodai9fdFRDbAfE4U6lm2clJYmaJfU2vWWMkS4B0S4rYHZRBscZnMeadFzykS4rRVySSD1HRuEiFyuKwrOAcJEZTaShHzdMwBMo7XGBVibauQchK9gznfQKBgBjYNctWf0ufNCDrzgyEOgqsNK0bseopv4vz/SvUpsVuMLxIOZgTE2zfRi0GFoB61Bo6R1+D3NlDZdfzu6sXX/t5mS4SjeZoucEtKUZQmVxwScwKPjyAaagroIJYqt1+pjVXaiXRwUac6i4rprCRiyXjt5fWaqBrCv9wEIdEJlsU";

	public static PublicKey string2PublicKey(String pubStr) throws Exception {
		try {
			byte[] buffer = Base64Utils.decode(pubStr);
			KeyFactory keyFactory = KeyFactory.getInstance(RSA);
			X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
			return keyFactory.generatePublic(keySpec);
		} catch (NoSuchAlgorithmException e) {
			throw new Exception("无此算法");
		} catch (InvalidKeySpecException e) {
			throw new Exception("公钥非法");
		} catch (NullPointerException e) {
			throw new Exception("公钥数据为空");
		}
	}

	/**
	 * 获取公钥长度
	 *
	 * @param publicKey 公钥
	 * @return
	 */
	public static int getKeySize(PublicKey publicKey) {
		RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey;
		return rsaPublicKey.getModulus().bitLength();
	}

	/**
	 * Base64编码转字节数组
	 *
	 * @param base64Key
	 * @return
	 * @throws IOException
	 */
	public static byte[] base642Byte(String base64Key) throws IOException {
		BASE64Decoder decoder = new BASE64Decoder();
		return decoder.decodeBuffer(base64Key);
	}

	/**
	 * 获取私钥长度
	 *
	 * @param privateKey 私钥
	 * @return
	 */
	public static int getKeySize(PrivateKey privateKey) {
		RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) privateKey;
		return rsaPrivateKey.getModulus().bitLength();
	}

	/**
	 * 公钥加密
	 *
	 * @param content         明文
	 * @param publicKeyBase64 公钥base64
	 * @return
	 */
	public static byte[] publicEncrypt(byte[] content, String publicKeyBase64) {
		try {
			Cipher cipher = Cipher.getInstance(RSA);
			PublicKey publicKey = string2PublicKey(publicKeyBase64);
			cipher.init(Cipher.ENCRYPT_MODE, publicKey);
			int keyBit = getKeySize(publicKey);
			int inputLen = content.length;
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			int offSet = 0;
			int step = keyBit / 8 - 11;

			for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
				byte[] cache;
				if (inputLen - offSet > step) {
					cache = cipher.doFinal(content, offSet, step);
				} else {
					cache = cipher.doFinal(content, offSet, inputLen - offSet);
				}
				out.write(cache, 0, cache.length);
				++i;
			}
			byte[] encryptedData = out.toByteArray();
			out.close();
			return encryptedData;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

	/**
	 * 将Base64编码后的私钥转换成PrivateKey对象
	 *
	 * @param priStr base64私钥
	 * @return
	 * @throws Exception
	 */
	public static PrivateKey string2PrivateKey(String priStr) throws Exception {
		byte[] keyBytes = Base64Utils.decode((priStr));
		PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
		KeyFactory keyFactory = KeyFactory.getInstance("RSA");
		return keyFactory.generatePrivate(keySpec);
	}

	/**
	 * 私钥解密
	 *
	 * @param content          密文
	 * @param privateKeyBase64 私钥base64
	 * @return
	 * @throws Exception
	 */
	public static byte[] privateDecrypt(byte[] content, String privateKeyBase64) throws Exception {
		try {
			Cipher cipher = Cipher.getInstance(RSA);
			PrivateKey privateKey = string2PrivateKey(privateKeyBase64);
			cipher.init(Cipher.DECRYPT_MODE, privateKey);
			int keyBit = getKeySize(privateKey);
			int inputLen = content.length;
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			int offSet = 0;
			int step = keyBit / 8;

			for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
				byte[] cache;
				if (inputLen - offSet > step) {
					cache = cipher.doFinal(content, offSet, step);
				} else {
					cache = cipher.doFinal(content, offSet, inputLen - offSet);
				}
				out.write(cache, 0, cache.length);
				++i;
			}
			byte[] decryptedData = out.toByteArray();
			out.close();
			return decryptedData;
		} catch (Exception e) {
			return null;
		}
	}

	/**
	 * 私钥解密
	 *
	 * @param base64 加密字符串
	 */
	public static String privateDecrypt(String base64, String privateKeyBase64) {
		try {
			byte[] decryptBytes = privateDecrypt(base642Byte(base64), privateKeyBase64);
			return new String(decryptBytes);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "";
	}

	/**
	 * 公钥加密
	 *
	 * @param content         明文
	 * @param publicKeyBase64 公钥base64
	 * @return
	 */
	public static String publicEncrypt(String content, String publicKeyBase64) {
		return new String(Base64.encodeBase64(publicEncrypt(content.getBytes(), publicKeyBase64)));
	}

	/**
	 * 加密
	 *
	 * @param context
	 * @return
	 */
	public static String publicEncrypt(String context) {
		return publicEncrypt(context, publicKey);
	}

	/**
	 * 解密
	 *
	 * @param context
	 * @return
	 */
	public static String privateDecrypt(String context) {
		return privateDecrypt(context, privateKey);
	}

	public static String privateDecryptUvInterceptConfig(String context) {
		try {
			return JSON.parseObject(privateDecrypt(context)).getString("uvInterceptConfig");
		} catch (Exception e) {
			return "";
		}
	}

	public static String privateDecryptUvInterceptConditionConfig(String context) {
		try {
			return JSON.parseObject(privateDecrypt(context)).getString("uvInterceptConditionConfig");
		} catch (Exception e) {
			return "";
		}
	}

	public static String privateDecryptExcludeDistributorIds(String context) {
		try {
			return JSON.parseObject(privateDecrypt(context)).getString("excludeDistributorIds");
		} catch (Exception e) {
			return "";
		}
	}

	public static Map<String, String> privateDecryptPlanRiskControlList(String context) {
		try {
			return JSON.parseObject(privateDecrypt(context)).getJSONObject("planRiskControlList").toJavaObject(Map.class);
		} catch (Exception e) {
			return new HashMap<>();
		}
	}

	public static void main(String[] args) {
		// 加密 https:/ /axh2.za-xd.com/merchant-api/axh/matching
		String json = "{\n" +
				"    \"excludeDistributorIds\": \"237,238,236,235\",\n" +
				"    \"uvInterceptConfig\":[\n" +
				"     {\n" +
				"         \"id\":\"fujianxiamen\",\n" +
				"         \"pushDistributorId\":\"145\",\n" +
				"         \"hitApi\":\"https://dis.zzm6888.com/api/kyjf-api/check-user\",\n" +
				"         \"applyUrl\":\"https://dis.zzm6888.com/api/kyjf-api/apply\",\n" +
				"         \"threshold\":15,\n" +
				"         \"riskControl\":-1,\n" +
				"         \"age\":\"23,55\",\n" +
				"         \"houseProduction\":\"有\",\n" +
				"         \"carProduction\":\"有\",\n" +
				"         \"socialInsurance\":\"有\",\n" +
				"         \"publicReserveFunds\":\"有\",\n" +
				"         \"zmScore\":\"650-1000\",\n" +
				"         \"interceptUserRule\":\"5,3\",\n" +
				"         \"assetDistributeRule\":\"1\",\n" +
				"         \"distributeRegion\":\"天津市,浙江省-宁波市,四川省-成都市\"\n" +
				"     },\n" +
				"\t {\n" +
				"         \"id\":\"sichuanchengdu\",\n" +
				"         \"pushDistributorId\":\"145\",\n" +
				"         \"hitApi\":\"https://dis.zzm6888.com/api/kyjf-api/check-user\",\n" +
				"         \"applyUrl\":\"https://dis.zzm6888.com/api/kyjf-api/apply\",\n" +
				"         \"threshold\":15,\n" +
				"         \"riskControl\":-1,\n" +
				"         \"age\":\"23,55\",\n" +
				"         \"houseProduction\":\"有\",\n" +
				"         \"carProduction\":\"有\",\n" +
				"         \"socialInsurance\":\"有\",\n" +
				"         \"publicReserveFunds\":\"有\",\n" +
				"         \"zmScore\":\"650-1000\",\n" +
				"         \"interceptUserRule\":\"5,3\",\n" +
				"         \"assetDistributeRule\":\"1\",\n" +
				"         \"distributeRegion\":\"山东省-济南市,江苏省-常州市,江苏省-无锡市\"\n" +
				"     }\n" +
				"    ]\n" +
				"}";
		//String context = publicEncrypt(json);
		String context = "HN1PYK3CbZX3dxnWmXJI77cdhxj3GQ3LFT8laPeSTTpsVD2FEzXZWHI5+j/ucuXnX6MdW5/UPnBNR6lW+P8zT6tewKNZ9zFsLBU4VcLGlDySZrlx9fgCxh6z8Y+cWmzCLrJdTnMhY5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uCTWIZUCkMlSohSh65uCU6OJ30a8hMpLQkiNRQAqwhnsdiNyXjPfj/oF746S35JMSN8g+aQQY7zSKgN4846XBs4ZIZ6kAeodtJtqMcY21lYum9BB88KgeNz4KkHVadvjCTzsxUAlD04J9BABmoysJT00Wt1rCyk63gCFIUhyNTy4+45q5ivT/a/dLFgcWlFVRVB07YrU6ncefh45dl//wxxpgXzBOrMcapxdFRzJ/gp+vNMuD05kfLHCY2RAqruuemXzHK1XvSgSaI=\n";
		System.out.println("context = " + context);
		System.out.println(privateDecrypt(context));
		System.out.println(privateDecryptUvInterceptConfig(context));
	}

}
